package nowCoder;

import java.util.*;

public class HJ28 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int[] b = new int[a];
        int sum = 0;
        for(int i = 0; i< a; i++){
            b[i] = in.nextInt();
        }
        Arrays.sort(b);
        for(int i = 0 ;i< a-1 ; i++){
            if(b[i] == -1){
                continue;
            }
            for(int j = i+1; j< a ; j ++){
                if(b[j] == -1){
                    continue;
                }
                boolean s = false;
                for (int k = 2; k <= Math.sqrt(b[i] + b[j]); k++) {
                    if ((b[i] + b[j]) % k == 0){
                        s = true;
                        break;
                    }
                }
                if (!s){
                    b[i] = -1;
                    b[j] = -1;
                    sum ++;
                    break;
                }
            }
        }
        System.out.println(sum);
    }
}
